from selenium import webdriver
from time import sleep
from selenium.webdriver.common.by import By

op = webdriver.ChromeOptions()
op.add_experimental_option("excludeSwitches", ["enable-automation"])
# op.add_argument('--start-maximized')#窗口最大化
op.add_argument('--headless')
op.add_argument('--disable-gpu')
driver = webdriver.Chrome(options=op)
# driver = webdriver.Chrome()
driver.get('https://www.baidu.com')
sleep(2)

# driver.find_element_by_id('kw').send_keys('自动化测试')
# driver.find_element_by_id('su').click()
driver.find_element(By.ID,'kw').send_keys('自动化测试')
driver.find_element(By.ID,'su').click()
sleep(3)

assert  '自动化测试' in driver.page_source
driver.quit()